package FIT::Util::t::ClassLoader;

use FIT::Test 'FIT::Util::ClassLoader';

sub broken_load: Test {
    eval { IUT->load('Some_Non_Existin_Package') };
    like $@, qr/load package/;
}

sub good_load: Test {
    eval { IUT->load('FIT::Document::Transformer::Void') };
    ok !$@;
}

sub create: Test(2) {
    my $class = 'ClassLoader_t_create';
    IUT->create(name => $class, base => IUT, methods => {foo => sub { 'bar' }});
    IUT->load($class);
    my $instance = $class->new;
    is ref $instance, $class, 'correct class';
    is $instance->foo, 'bar', 'method installed';

}
